#!/usr/bin/env bash

set -euo pipefail

container_manager="$(command -v podman 2>/dev/null || true)"
test -z "$container_manager" && container_manager='docker'

image='greppo-demo-dev'
port='8080'
mount_point='/home/greppo/greppo-demo'

mydir="$(dirname "$0")/"
cd "$mydir"

"$container_manager" build --tag="$image" .
exec "$container_manager" run --pull never -it -e 'TERM=xterm-256color' -v "$(pwd):$mount_point" -p "$port:$port" --rm "$image" "$@"
